<?php 

include '../function.php';
// 1.链接数据库，选择库
$mysqli = @new mysqli("127.0.0.1", "root", "", "school");

if($mysqli->connect_errno){
	exit("错误代码：".$mysqli->connect_errno."错误信息：".$mysqli->connect_error);
}

// 2、发送编码
$mysqli->query("set names utf8");

// $id = $_GET['id'];

// $sql  = "select * from stu where id=?";


// var_dump($sql);exit;

// 预准备语句
$sql = "insert into stu(name,age) values(?,?)";

$stmt = $mysqli->prepare($sql);

if($stmt){
	// 绑定参数
	$stmt->bind_param('si', $name, $age);
	
	for ($i=0; $i < 1000; $i++) { 
		$name="小明1".$i;
		$age = 18;
		$stmt->execute();
	}

}












// 关闭链接
$mysqli->close();





















 ?>